<?php

namespace App\Http\Controllers\Api;

use App\Models\Site;

use App\Http\Resources\Site as SiteCollection;
use Illuminate\Support\Facades\Input;


class SitesController extends ApiController
{

    /**
     *
     * @api {get} /sites 获取合作网站
     * @apiName Sites get 10
     * @apiGroup Sites
     *
     * @apiParam {String} [limit] 限制的条数
     *
     * @apiVersion 1.0.0
     * @apiSampleRequest /api/sites
     *
     */
    public function index(){

        $limit = Input::get('limit') ?: 10;

        $sites = Site::orderBy('order','desc')
            ->limit($limit)->get();

        return SiteCollection::collection($sites);

    }
}
